import sys
import os
import time
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngineWidgets import *
import PyQt5.QtGui as QtGui
import socket

class MainWindow(QMainWindow):
    def __init__(self, url):
        super(MainWindow, self).__init__()
        self.setWindowTitle('算法可视化系统')

        navigation_bar = QToolBar('Navigation')
        # 设定图标的大小

        self.setWindowIcon(QtGui.QIcon("assets/icon.png"))
        self.setGeometry(5,30,1355,640)
        self.browser=QWebEngineView()
        self.browser.load(QUrl(url))
        # with open('./stylesheet.qss') as f:
        #     qApp.setStyleSheet(f.read())

        navigation_bar.setIconSize(QSize(30,30))
        self.addToolBar(navigation_bar)
        reload_button = QAction(QIcon('./assets/refresh.png'), '刷新', self)
        # reload_button = QWidgetAction(self)
        # label = QLabel(QIcon('./assets/refresh.png'))
        #
        # reload_button.setDefaultWidget(label)
        # reload_button.setIcon(QIcon('./assets/refresh.png'))
        reload_button.triggered.connect(self.browser.reload)

        navigation_bar.addAction(reload_button)
        navigation_bar.addSeparator()

        self.setCentralWidget(self.browser)
        self.resize(1920, 920)

if __name__ == '__main__':

    from run import *

    greedy()
